<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
var content;

function encode() {
	var str = "li litong";
	var text = encodeURIComponent(str);
	content = text;
	alert(text);
}

function decode() {
	var str = decodeURIComponent(content);
	alert(str);
}
</script>
</head>

<body>
<input type="button" value="编码" onclick="encode()">
<input type="button" value="解码" onclick="decode()">
</body>

</html>